home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD023b.dsk
/
RIGHT TRIANGLE.bas
< prev
next >
Wrap
BASIC Source File
|
2003-06-12
|
6KB
|
195 lines
10 REM SOLUTION TO TRIANGLE
20 REM *=*=*=*=*=*=*=*=*=*=*=
30 HOME
40 HGR : HCOLOR= 3
50 REM
60 REM MAKE * TRIANGLE *
70 REM
80 HPLOT 30,15 TO 30,130
90 HPLOT TO 225,130
100 HPLOT TO 30,15
110 HPLOT 30,115 TO 50,115
120 HPLOT TO 50,130
130 REM
140 REM MAKE * A *
150 REM
160 HPLOT 10,90 TO 10,75
170 HPLOT TO 15,70
180 HPLOT TO 20,75
190 HPLOT TO 20,90
200 HPLOT 10,80 TO 20,80
210 REM
220 REM MAKE * B *
230 REM
240 HPLOT 94,159 TO 95,140
250 HPLOT TO 102,140
260 HPLOT TO 105,142
270 HPLOT TO 105,148
280 HPLOT TO 102,150
290 HPLOT TO 105,152
300 HPLOT TO 105,157
310 HPLOT TO 103,159
320 HPLOT TO 95,159
330 HPLOT 95,150 TO 102,150
340 REM
350 REM MAKE * C *
360 REM
370 HPLOT 145,65 TO 137,65
380 HPLOT TO 135,61
390 HPLOT TO 135,49
400 HPLOT TO 137,45
410 HPLOT TO 145,45
420 REM
430 REM MAKE * D *
440 REM
450 HPLOT 140,120 TO 140,100
460 HPLOT TO 145,100
470 HPLOT TO 150,105
480 HPLOT TO 150,115
490 HPLOT TO 145,120
500 HPLOT TO 140,120
510 HPLOT 143,122 TO 143,130
520 HPLOT TO 140,127
530 HPLOT TO 145,127
540 HPLOT TO 143,130
550 HPLOT 142,96 TO 145,85
560 HPLOT 142,87 TO 147,86
570 REM
580 REM ** INPUTS **
590 REM
600 PD = 57.29577795: REM 180/PI
610 RD = .01745329: REM PI/180
620 VTAB 21: PRINT "---------------------------------"
630 VTAB 22: HTAB 4: INPUT "A? ";A$:A = VAL(A$)
640 VTAB 22: HTAB 20: INPUT "B? ";B$:B = VAL(B$)
650 IF A >0 AND B >O THEN 740
660 VTAB 23: HTAB 4: INPUT "C? ";C$:C = VAL(C$)
670 IF A >0 AND C >0 THEN 800
680 IF B >0 AND C >0 THEN 950
690 VTAB 23: HTAB 20: INPUT "D? ";D$:D = VAL(D$)
700 IF A >0 AND D >0 THEN 880
710 IF B >O AND D >0 THEN 1020
720 IF C >0 AND D >0 THEN 1090
730 HOME : PRINT CHR$(7): VTAB 23: HTAB 5: PRINT "INSUFFICIANT INFORMATION!!": FOR PA = 1 TO 1000: NEXT PA: HOME : GOTO 620
740 REM
750 REM * A&B FIND C&D *
760 REM
770 C = SQR((A ^2) +(B ^2))
780 D = ATN(A/B) *PD: GOSUB 1630
790 GOSUB 1440: GOTO 1200
800 REM
810 REM * A&C FIND B&D *
820 REM
830 GOSUB 1440
840 ONERR GOTO 1240
850 B = SQR(C ^2 -A ^2)
860 D = ATN(A/B) *PD: GOSUB 1630
870 GOSUB 1440: GOTO 1200
880 REM
890 REM * A&D FIND B&C *
900 REM
910 GOSUB 1350
920 C = A/ SIN(D *RD)
930 B = SQR((C ^2) -(A ^2))
940 GOSUB 1440: GOTO 1200
950 REM
960 REM * B&C FIND A&D *
970 REM
980 ONERR GOTO 1250
990 A = SQR((C ^2) -(B ^2))
1000 D = ATN(A/B) *PD: GOSUB 1630
1010 GOSUB 1440: GOTO 1200
1020 REM
1030 REM * B&D FIND A&C *
1040 REM
1050 GOSUB 1350
1060 C = B/( COS(D *RD))
1070 A = B *( TAN(D *RD))
1080 GOSUB 1440: GOTO 1200
1090 REM
1100 REM * C&D FIND A&B *
1110 REM
1120 GOSUB 1350
1130 A = C *( SIN(D *RD))
1140 B = C *( COS(D *RD))
1150 GOSUB 1440: GOTO 1200
1160 REM
1170 REM * ROUND OFF *
1180 REM
1190 X = INT(X *10000 +.5)/10000: RETURN
1200 REM
1210 REM * OUTPUT TO SCREEN *
1220 REM
1230 IF A >B THEN HOME : PRINT CHR$(7): VTAB 23: HTAB 3: PRINT "A CANNOT BE GREATER THAN B!!": FOR PA = 1 TO 1000: NEXT PA: HOME : GOTO 620
1240 IF A >C THEN HOME : PRINT CHR$(7): VTAB 23: HTAB 3: PRINT "A CANNOT BE GREATER THAN C!!": FOR PA = 1 TO 1000: NEXT PA: HOME : GOTO 620
1250 IF B >C THEN HOME : PRINT CHR$(7): VTAB 23: HTAB 3: PRINT "B CANNOT BE GREATER THAN C!!": FOR PA = 1 TO 1000: NEXT PA: HOME : GOTO 620
1260 HOME
1270 VTAB 21: PRINT "---------------------------------"
1280 VTAB 22: HTAB 4: PRINT "A= ": VTAB 22: HTAB 20: PRINT "B= ": VTAB 23: HTAB 4: PRINT "C= ": VTAB 23: HTAB 20: PRINT "D= "
1290 VTAB 22: HTAB 7: PRINT "00.0000": VTAB 22: HTAB 23: PRINT "00.0000": VTAB 23: HTAB 7: PRINT "00.0000": VTAB 23: HTAB 23: PRINT "00.0000"
1300 X = A: GOSUB 1720:A = X: VTAB 22: HTAB (HT): PRINT A
1310 X = B: GOSUB 1720:B = X: VTAB 22: HTAB (HT +16): PRINT B
1320 X = C: GOSUB 1720:C = X: VTAB 23: HTAB (HT): PRINT C
1330 X = D: GOSUB 1720:D = X: VTAB 23: HTAB (HT +16): PRINT D
1340 WAIT -16384,128: POKE -16368,0: HOME : IF PEEK( -16384) < >27 THEN 620
1345 PRINT : TEXT : PRINT "<CTRL-D>RUNMENU"
1350 REM
1360 REM * DEG TO DEC *
1370 REM
1380 AA = INT(D)
1390 AB = (D -AA) *100
1400 AC = INT(AB +.0001)
1410 AD = (AB -AC) *100
1420 D = AA +(AC/60) +(AD/3600)
1430 RETURN
1440 REM
1450 REM * SEND TO ROUND OFF *
1460 REM
1470 X = A: GOSUB 1160:A = X
1480 X = B: GOSUB 1160:B = X
1490 X = C: GOSUB 1160:C = X
1500 X = D: GOSUB 1160:D = X
1510 AA = INT(D)
1520 AB = (D -AA) +.00001
1530 AC = AB *100
1540 AD = INT(AC)
1550 AE = INT((AC -AD) *100)
1560 IF AE >60 THEN AE = AE -60:AD = AD +1
1570 IF AE = 60 THEN AE = 0:AD = AD +1
1580 IF AD = 60 THEN AD = 0:AA = AA +1
1590 IF AE = 0 AND AD >0 THEN D = AA +(AD/100): RETURN
1600 IF AD = 0 AND AE >0 THEN D = AA +(AE/10000): RETURN
1610 IF AE = 0 AND AD = 0 THEN D = AA: RETURN
1620 RETURN
1630 REM
1640 REM * DEC TO DEG *
1650 REM
1660 AB = INT(D)
1670 AC = 60 *(D -AB)
1680 AD = INT(AC +.0001)
1690 AE = 60 *(AC -AD)
1700 D = AB +(AD/100) +(AE/10000)
1710 RETURN
1720 REM
1730 REM GET RID OF
1740 REM SCI. NOTATION
1750 REM & SET HTABS
1760 REM
1770 IF X <.010 THEN X = X *10000:HT = 12: RETURN
1780 IF X *1000 = 10 THEN HT = 9: RETURN
1790 IF X >.010 AND X <1 THEN HT = 9: RETURN
1800 IF X = >1 AND X <10 THEN HT = 8: RETURN
1810 IF X = >10 AND X <100 THEN HT = 7: RETURN
1820 HT = 6: RETURN
1830 REM
1840 REM
1850 REM ********************
1860 REM * *
1870 REM * DON MANCIER *
1880 REM * 47219 DEQUINDRE *
1890 REM * ROCHESTER MI *
1900 REM * 48063 *
1910 REM * *
1920 REM * (313) 852-5965 *
1930 REM * *
1940 REM ********************